class ArticleLogicController {

    def feedback = {
        
        def articleInstance = Article.get(params.id)
        if (articleInstance) {
            def accept = []
            def unaccept = []
            def feedbacks = Feedback.findAllBySender(articleInstance)
            articleInstance?.receiver.each{user ->
                def any = feedbacks.any{feedback->
                    feedback.receiver == user 
                }
                if (any) {
                    accept.add(user)
                }else{
                    unaccept.add(user)
                }
            }

            ['accept':accept , 'unaccept' : unaccept]
        }
  
    }
}
